import request from '@/utils/request'
import { GEN_SERVER } from '@/config/baseUrl'

//工作台-异常列表(待处理/进行中)
export function abnormalWorkList(data) {
  return request({
    url: GEN_SERVER['auxiliary-server'] + '/abnormal/order/index/work',
    method: 'post',
    data: data
  })
}

//工作台-获取用户基本信息
export function workUserInfo(data) {
  return request({
    url: GEN_SERVER['produce-server'] + '/data/workshop/index/work',
    method: 'get'
  })
}

//根据产线  查询未关闭的工单
export function getUnClosedOrder(data) {
  return request({
    url: GEN_SERVER['produce-server'] + '/handover/order/listUnClosedOrderByLineIdOrCurrentUser',
    method: 'post',
    data: data
  })
}

//获取当前产线生产中的交接班记录
export function getProducingGroupByLineId(data) {
  return request({
    url: GEN_SERVER['produce-server'] + '/handover/groupProduceLog/getProducingGroupByLineId',
    method: 'get',
    params: data
  })
}

// 新增或保存工作台工作日志
export function addOrUpdatedLog(data) {
  return request({
    url: GEN_SERVER['auxiliary-server'] + '/work/log/addOrUpdate',
    method: 'post',
     data: data
  })
}

// 查询本人最近提交
export function getLogByUser(data) {
  return request({
    url: GEN_SERVER['auxiliary-server'] + '/work/log/getByUser',
    method: 'post',
     data: data
  })
}

// 查询工作台工作日志列表
export function getHistoryLog(data) {
  return request({
    url: GEN_SERVER['auxiliary-server'] + '/work/log/list',
    method: 'post',
    data: data
  })
}

//工作台-待审核上报列表
export function approvalWorkList(data) {
  return request({
    url: GEN_SERVER['auxiliary-server'] + '/abnormal/distribute/index/work',
    method: 'post',
    data: data
  })
}

//工作台-今日预警
export function warmWorkList(data) {
  return request({
    url: GEN_SERVER['auxiliary-server'] + '/abnormal/warm/index/work',
    method: 'post',
    data: data
  })
}

//工作台-改善任务列表-待处理
export function workHandleList(data) {
  return request({
    url: GEN_SERVER['form-server'] + '/refine/order/index/work/exec',
    method: 'post',
    data: data
  })
}

//工作台-改善任务列表-待审核
export function workApprovalList(data) {
  return request({
    url: GEN_SERVER['form-server'] + '/refine/order/index/work/check',
    method: 'post',
    data: data
  })
}

//工作台-改善任务列表-今日超时
export function workOutList(data) {
  return request({
    url: GEN_SERVER['form-server'] + '/refine/order/index/work/out',
    method: 'post',
    data: data
  })
}

//工作台-待审核上报改善点
export function workReportList(data) {
  return request({
    url: GEN_SERVER['form-server'] + '/refine/report/index/work',
    method: 'post',
    data: data
  })
}

//工作台-核心关注预警
export function coreFocusWarn (data) {
  return request({
    url: GEN_SERVER['auxiliary-server'] + '/abnormal/warm/follow/work',
    method: 'post',
    data: data
  })
}

//工作台-核心关注异常
export function coreFocusAbnormal (data) {
  return request({
    url: GEN_SERVER['auxiliary-server'] + '/abnormal/order/follow/work',
    method: 'post',
    data: data
  })
}

//工作台-核心关-获取设备停机情况
export function getOffEquipment (data) {
  return request({
    url: GEN_SERVER['produce-server'] + '/data/equipment/run/listEquipmentOffLog',
    method: 'post',
    data: data
  })
}

//工作台-核心关-获取设备运行状态
export function getEquipmentRunStatus (data) {
  return request({
    url: GEN_SERVER['produce-server'] + '/data/equipment/run/listEquipmentRunStatus',
    method: 'get',
    params: data
  })
}

//工作台-核心关注-任务异常分析
export function getTaskSummary (data) {
  return request({
    url: GEN_SERVER['form-server'] + '/task/missionCenter/taskSummary',
    method: 'post',
    data: data
  })
}

//工作台-设备运行情况-根据产线获取设备列表
export function getEquipByLineIds (data) {
  return request({
    url: GEN_SERVER['produce-server'] + '/data/equipment/listEquipByLineIds',
    method: 'get',
    params: data
  })
}

//工作台-设备运行情况-获取设备关联指标列表
export function getEquipIndexByEquipId (data) {
  return request({
    url: GEN_SERVER['index-server'] + '/scada/scadaPoint/getEquipIndexValueByEquipId',
    method: 'get',
    params: data
  })
}

//工作台-设备运行情况-设备预警列表
export function getWarmEquipment (data) {
  return request({
    url: GEN_SERVER['auxiliary-server'] + '/abnormal/warm/equipment/work',
    method: 'post',
    data: data
  })
}

//工作台-设备运行情况-设备异常列表
export function getAbnormalEquipment (data) {
  return request({
    url: GEN_SERVER['auxiliary-server'] + '/abnormal/order/equipment/work',
    method: 'post',
    data: data
  })
}

//工作台-设备运行情况-获取指标趋势图
export function getIndexValueDatas (data) {
  return request({
    url: GEN_SERVER['index-server'] + '/value/getIndexValueDatas',
    method: 'get',
    params: data
  })
}

//工作台-设备运行情况-获取关注指标列表
export function getFollowIndex (data) {
  return request({
    url: GEN_SERVER['index-server'] + '/follow/list',
    method: 'get',
    params: data
  })
}

//工作台-设备运行情况-更新关注指标列表
export function addOrUpdateIndex (data) {
  return request({
    url: GEN_SERVER['index-server'] + '/follow/addOrUpdate',
    method: 'post',
    data: data
  })
}

//工作台-常用功能
export function getUserCommonModules (data) {
  return request({
    url: GEN_SERVER['admin-server'] + '/system/user/profile/getUserCommonModules',
    method: 'get',
    params: data
  })
}


